﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TJBHJJ.Models;

namespace TJBHJJ.Controllers
{
    public class DownloadsController : Controller
    {
        //
        // GET: /Download/

        Home home = new Home();
        public ActionResult Index(int page = 0)
        {
            ViewData["pageCount"] = home.Downloads.Count / home.PageSize;
            ViewData["pageIndex"] = page;
            return View(home.Page<Down>(home.Downloads, page));
        }
        public ActionResult Detail(int page, int id)
        {
            Down down = home.Downloads.Where(x => x.Id == id).SingleOrDefault();
            if (down == null)
                return null;
            else
            {
                ViewData["group"] = home.Group(home.Downloads, id);
                ViewData["page"] = page;
                return View(down);
            }
        }

    }
}
